<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>商家入驻</title>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge=Chrome">
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
  <link rel="stylesheet" href="/lib/weui.min.css">
  <link rel="stylesheet" href="/css/jquery-weui.css">
  <link rel="stylesheet" href="/css/style.css">
    <style>
        input::-webkit-input-placeholder{
            color:red;
        }
        input::-moz-placeholder{   /* Mozilla Firefox 19+ */
            color:red;
        }
        input:-moz-placeholder{    /* Mozilla Firefox 4 to 18 */
            color:red;
        }
        input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
            color:red;
        }
    </style>
</head>
<body ontouchstart>
<!--主体-->
<header class="wy-header">
  <div class="wy-header-icon-back" onclick="back();"><span></span></div>
  <div class="wy-header-title">商家入驻</div>
</header>
<FORM action="success.htm" METHOD="post" id="sbumitq" enctype="multipart/form-data">
  <div class="weui-content">
    <div class="weui-cells weui-cells_form wy-address-edit">
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">法人姓名</label></div>
        <div class="weui-cell__bd"><input class="weui-input" type="text"  placeholder="" id="name"  name="leganName"></div>
       <div class="weui-cell" style="display:none;" id="tname"><div id="name01" style="color: red"></div></div>
        <div class="weui-cell" style="display:none;" ><input type="hidden" name="storeState" value="待审核" /></div>
      </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label wy-lab">法人性别</label></div>
            <div class="weui-cell__bd"><input id="man" type="radio" checked="checked" name="gender" value="男"/>男<input id="woman" type="radio"  name="gender" value="女"/>女</div>

        </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">身份证</label></div>
        <div class="weui-cell__bd"><input class="weui-input" type="text"  placeholder=""  name="leganCode" id="leganCode"></div>
        <div class="weui-cell" style="display:none;" id="tleganCode"><div id="leganCode01" style="color: red"></div></div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">公司名称</label></div>
        <div class="weui-cell__bd"><input class="weui-input" type="text" pattern="[\u2E80-\u9FFF]+" placeholder=""  required="required" name="companyName" id="companyName"></div>
        <div class="weui-cell" style="display:none;" id="tcompanyName"><div id="companyName01" style="color: red"></div></div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">营业执照</label></div>
        <div class="weui-cell__bd"><input class="weui-input" type="text" pattern="[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)" placeholder=""  required="required" id="businessNum" name="businessNum"><div id="tbusinessNum" style="color: red"></div></div></div>
        <div class="weui-cell" style="display:none;" id="tbusinessNum"><div id="businessNum01" style="color: red"></div></div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">执照正本</label></div>
        <div class="weui-cell__bd">  <input type="file" id="chooseImage" name="file" placeholder="">
            <!-- 保存用户自定义的背景图片 -->
            <img id="cropedBigImg" value='custom' alt="" data-address='' title="自定义背景" style="height: 172px;width: 375px;"/><input/></div>
      </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label wy-lab">开户行</label></div>
            <div class="weui-cell__bd"><input class="weui-input" type="text" pattern="[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)" placeholder=""  required="required" id="bank" name="bank"></div>

        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label wy-lab">开户账号</label></div>
            <div class="weui-cell__bd"><input class="weui-input" type="text" pattern="[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)" placeholder=""  required="required" id="bankCode" name="bankCode"></div>

        </div>
      <div class="weui-cell weui-cell_vcode">
        <div class="weui-cell__hd"><label class="weui-label wy-lab">手机号</label></div>
        <div class="weui-cell__bd"><input class="weui-input" type="tel"  placeholder=""   name="phone" id="phone"></div>
        <!--<div class="weui-cell__ft"><div style="cursor: pointer" class="weui-vcode-btn" onclick="yanzheng()">获取验证码</div></div>-->
        <div class="weui-cell__ft"><div style="cursor: pointer" class="weui-vcode-btn" onclick="yanzheng()">获取验证码</div></div>
        <!--<div class="weui-cell__ft"><div style="cursor: pointer" class="weui-vcode-btn" ><a href="javascript:yanzheng();">获取验证码</a></div></div>-->
        <!--<div class="weui-btn-area"><a href="javascript:yanzheng();" class="weui-btn weui-btn_warn">获取验证码</a></div>-->
       <div class="weui-cell" style=" display:none;" id="tphone"><div id="phone01" style="color: red"></div></div>
     </div>
     <div class="weui-cell weui-cell_vcode">
       <div class="weui-cell__hd" style="height: 40px;"><label class="weui-label wy-lab">验证码</label></div>
       <div class="weui-cell__bd"><input class="weui-input" type="text" placeholder="" id="yanz"></div>
       <div class="weui-cell__ft"><div class="weui-cell" style="display:none;" id="tyanz"><div id="yanz01" style="color: red"></div></div></div>
     </div>

   </div>
   <label for="weuiAgree" class="weui-agree">
     <input id="weuiAgree" type="checkbox" class="weui-agree__checkbox" checked="checked">
     <span class="weui-agree__text">阅读并同意<a href="javascript:void(0);">《入驻协议》</a></span>
   </label>
   <!--<div class="weui-btn-area"><a href="javascript:;" class="weui-btn weui-btn_warn">提交审核</a></div>-->
    <!--<div class="weui-btn-area"><a href="success.html" class="weui-btn weui-btn_warn" id="action">提交审核</a></div>-->
    <!--<div class="weui-btn-area"><input type="submit" class="weui-btn weui-btn_warn" id="action" value="提交审核"></input></div>-->
    <div class="weui-btn-area"><a href="javascript:tijiao();" class="weui-btn weui-btn_warn">提交审核</a></div>
    <div class="weui-cells__tips t-c font-12">登陆账号为您输入的手机号码</div>
    <div class="weui-cells__tips t-c pd-10"><a href="xieyi1.htm" class="weui-cell_link font-12">查看入驻协议</a></div>

  </div>
</FORM>
<script src="lib/jquery-2.1.4.js"></script>
<script src="lib/fastclick.js"></script>
<script type="text/javascript" src="js/jquery.Spinner.js"></script>
<script src="js/jquery-form.js"></script>
<script src="js/jquery-weui.js"></script>
<script>
    $("#chooseImage").on("change",function(){
        var filePath = $(this).val(),         //获取到input的value，里面是文件的路径
            fileFormat = filePath.substring(filePath.lastIndexOf(".")).toLowerCase(),
            src = window.URL.createObjectURL(this.files[0]); //转成可以在本地预览的格式

        // 检查是否是图片
        if( !fileFormat.match(/.png|.jpg|.jpeg/) ) {
            error_prompt_alert("上传错误,文件格式必须为：png/jpg/jpeg");
            return;
        }

        $("#cropedBigImg").attr("src",src);
    });


    $(function() {
        FastClick.attach(document.body);

    });
    var xcode;

       function yanzheng() {

                var name=$("#name").val();
                if(name==null||name==""){
                      $("#name").attr('placeholder',"法人姓名不能为空!");
                    return;
                }
                var leganCode=$("#leganCode").val();
                if(leganCode==null||leganCode==""){
                    $("#leganCode").attr('placeholder',"身份证不能为空！");
                    return;
                }
                var companyName=$("#companyName").val();
                if(companyName==null||companyName==""){
                    $("#companyName").attr('placeholder',"公司名称不能为空！");
                    return;
                }
                var imageid=$("#chooseImage").val();
                if(imageid==null||imageid==""){
                    $("#chooseImage").attr('placeholder',"请上传营业执照！");
                    return;
                }
                var phone=$("#phone").val();
                if(phone==null || phone==""){
                    $("#phone").attr('placeholder',"电话不能为空！");
                    return;
                }
                var reg = /^1[0-9]{10}$/;
                if(!reg.test(phone)){

                    $("#phone").attr('placeholder',"电话号码格式不正确！");
                    return;
                }
                var businessNum = $("#businessNum").val();

                jQuery.ajax({
                    url: "businessNum.htm",
                    data: {"businessNum": businessNum},
                    type: "post",
                    success: function (message) {
                        if (message == 1) {
                            $("#tbusinessNum").html("该营业执照已注册！");
                        }else{
                            jQuery.ajax({
                                url:"duanxin.htm",
                                data:{"phone":phone},
                                type:"post",
                                success:function(message01){
                                    if(message01 == 1){
                                        $("#phone").attr('placeholder',"验证码发送失败，请检查手机号码！");
                                    }else{
                                        xcode=message01;
                                    }

                                },
                                error:function(){
                                    alert("error!");
                                }
                            });
                        }
                    },
                    error:function(){
                        alert("error!");
                    }
                });

       }





    function tijiao() {
        var yanz=$("#yanz").val();
        var reg1 = /^[0-9]{6}$/;
        if(!reg1.test(yanz)||yanz!=xcode){

            $("#yanz").attr('placeholder',"验证码不正确！");
            return;
        }
        $("#sbumitq").submit();
    }
    function back() {
        window.location.href=document.referrer;
    }
</script>


</body>
</html>
